home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: August 14, 1996
- // Author: ms
- //
- // Description:
- // Process the numerical input.
- //
- // Input Arguments:
- // Numerical values (see scmh command for its syntax).
- //
- // Return Value:
- // None.
- //
-
- global proc numericalInput( string $value )
- {
- // If the string is empty then there is nothing to do here
- int $stringLen = `size $value`;
- if ( $stringLen == 0 ) return;
-
- // Define the character used to mean "ignore this entry position"
- //
- string $ignoreEntryChar = ".";
-
- // Tokenize the value string
- //
- string $valueArray[];
- int $numTokens = tokenize ($value, $valueArray);
-
- // Try to build up the proper string now
- //
- string $result;
- string $numbers;
- // scan for command flags
- //
- for ($i = 0; $i < $numTokens; $i++) {
- // Only need to add one flag to the result string
- if ($valueArray[$i] == "-a") {
- $result = (" " + $result + " " + $valueArray[$i]);
- break;
- }
- else if ($valueArray[$i] == "-r") {
- $result = (" " + $result + " " + $valueArray[$i]);
- break;
- }
- else if ($valueArray[$i] == "a") {
- // Put `-` in front of flag or command will complain
- $result = (" " + $result + " -a");
- break;
- }
- else if ($valueArray[$i] == "r") {
- // Put `-` in front of flag or command will complain
- $result = (" " + $result + " -r");
- break;
- }
- }
-
- // scan for numbers
- //
- int $offset = 1;
- for ($i = 0; $i < $numTokens; $i++) {
- if ($valueArray[$i] == $ignoreEntryChar) {
- $result = (" " + $result + " -ignore " + $offset);
- $offset++;
- $numbers = (" " + $numbers + " 0");
- }
- else if ($valueArray[$i] == "-a" || $valueArray[$i] == "a" ) {
- }
- else if ($valueArray[$i] == "-r" || $valueArray[$i] == "r" ) {
- }
- else if ($valueArray[$i] == "") {
- }
- else {
- $numbers = (" " + $numbers + " " + $valueArray[$i]);
- $offset++;
- }
- }
-
- $stringLen = `size $numbers`;
- if ( $stringLen > 0 )
- {
- catch(`eval( "scmh" + $result + $numbers )`);
- }
- }
-